package com.webside.front.common.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webside.front.common.mapper.RCommentMapper;
import com.webside.front.common.model.RComment;
import com.webside.front.common.service.RCommentService;
@Service("rCommentService")
public class RCommentServiceImpl implements RCommentService {
	@Autowired
	RCommentMapper rCommentMapper;
	
	public List<RComment> selectCommentsByCondition(Map<String, Object> condition) {
		return rCommentMapper.selectCommentsByCondition(condition);
	}

	public int selectCountByCondition(Map<String, Object> condition) {
		condition.put("status", 1);
		return rCommentMapper.selectCountByCondition(condition);
	}

	public boolean insertCommentOrLike(RComment rComment) {
		if (rCommentMapper.insertComment(rComment)>0) {
			return true;
		}
		return false;
	}
	
	public int updateChildrenCount(Integer parentId){
		return rCommentMapper.updateChildrenCount(parentId);
	}

}
